﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;



namespace Mirrors
{
    public class MyCamera
    {
        private Vector3 CP, CU;

        public Vector3 Up
        {
            get { return CU; }
            set { CU = value; }
        }

        public Vector3 Position
        {
            get { return CP; }
            set { CP = value; }
        }

        public MyCamera()
        {
            CP = new Vector3(0, 0, 0);
            CU = new Vector3(0, 0, 1);
        }


        public MyCamera(Vector3 InitialPosition, Vector3 InitialUp)
        {

            CP = InitialPosition;
            CU = InitialUp;

        }

        public Matrix ViewMatrix(Vector3 LookAt)
        {
            return Matrix.LookAtLH(CP, LookAt, CU);
        }

        public void TransformPosition(Matrix m)
        {
            Vector4 V = Vector3.Transform(CP, m);
            CP = new Vector3(V.X, V.Y, V.Z);
        }

        public void TransformUp(Matrix m)
        {
            Vector4 V = Vector3.Transform(CU, m);
            CU = new Vector3(V.X, V.Y, V.Z);
        }

    }
}
